/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package buzzerproxy; import java.io.DataOutputStream; import java.util.HashMap; /** * * @author Enger */ public class IO { IO() { } public boolean isIntNumber(String num) { try { Integer.parseInt(num); } catch (NumberFormatException nfe) { return false; } return true; } // public boolean isIntNumber(String num) { public String getFileExtension(String uri) { String extension = ""; String[] uriFileTyp = uri.split("\\."); extension = uriFileTyp[uriFileTyp.length - 1]; return extension; } // public String getFileExtension(String uri){ public boolean isValidFileTyp(String uri, String filetyp) { boolean is = false; boolean in = false; String[] content = filetyp.split("\\+"); String[] uriFileTyp = uri.split("\\."); for (int i = 0; i < content.length; i++) { //System.out.println("urifiletyp: "+uriFileTyp[uriFileTyp.length - 1] + " und " + content[i]); if (uriFileTyp[uriFileTyp.length - 1].contains(content[i].replaceFirst("\\.", ""))) { is = true; // System.out.println(uri + " und filetype: " + content[i] + " sind gleich"); } else { // System.out.println(uri + " und filetype: " + content[i] + " sind NICHT gleich"); }// if ( uri.endsWith(content[i])){ } // for ( int i=0;i l = new ArrayList(); // // String[] content = filetyp.split(""); // String fT = ""; // for (int i = 0; i < content.length; i++) { // if (in) { // fT += content[i]; // } // if (content[i].equals("\\.")) { // in = true; // } // if (content[i].equals("\\|")) { // in = false; // fT = ""; // l.add(fT); // } // } // for (int i = 0; i < content.length; i++) { // // String[] uriFileTyp = uri.split("\\."); // System.out.println("urifiletyp: "+uriFileTyp[uriFileTyp.length - 1]); // // for ( String ftyp : l){ // System.out.println("FileTyp: "+ftyp); // } //// for (int i = 0; i < content.length; i++) { //// //// if (uriFileTyp[uriFileTyp.length - 1].endsWith(content[i]) && !content[i].isEmpty()) { //// is = true; //// System.out.println(uri + " und filetype: " + content[i] + " sind gleich"); //// } else { //// System.out.println(uri + " und filetype: " + content[i] + " sind NICHT gleich"); //// }// if ( uri.endsWith(content[i])){ //// } // for ( int i=0;i